Kids and programming.htm

      MySQL Tutorial


      Databases & SQL for beginners

      MySQL is one of the most popular relational
      database management systems in the world and has also
      become very popular with PHP.
      Most PHP scripts you use daily on any websites use a
      MySQL database system in the background.
      MySQL is ideal for storing and accessing data in a database.
      This database stores, for example, user data of the registry,
      comments and contributions from forums, or the articles in a webshop.
      The learning curve with MySQL is very high and so you
      can very quickly write your own applications that
      go back in the background to a MySQL
      database.
      In our PHP tutorial, you learned how to deal with files,
      how to get them into these, e.g. Values can be stored.
      Instead of migrating files directly to the database,
      it is recommended to change the value of the new values,
      search the search entries, and delete certain lines using
      the database, rather than the same solution with text files.
      In this tutorial, you'll learn the basics of MySQL
      and how to access MySQL with MySQL.
      If you are looking for a comprehensive reference to MySQL,
      we can recommend you the almost 800-page book MySQL:
      The comprehensive manual.
      If you like something more compact,
      you might be interested in the book
      Databases & SQL for beginners.

      more SQL Tutorial    SQL Certificate

      What is SQL?

      SQL stands for Structured Query Language
      SQL lets you access and manipulate databases
      SQL is an ANSI (American National Standards Institute) standard

      SQL has other functions such as:
      SQL can execute queries against a database
      SQL can retrieve data from a database
      SQL can insert records in a database
      SQL can update records in a database
      SQL can delete records from a database
      SQL can create new databases
      SQL can create new tables in a database
      SQL can create stored procedures in a database
      SQL can create views in a database
      SQL can set permissions on tables, procedures, and views

      SQL perform the following functions such as
      SELECT, UPDATE, DELETE, INSERT, WHERE

      SQL is a standard language for storing, manipulating and retrieving data in databases.
      SQL could be used in the following database systems:
      namely, MySQL, SQL Server, MS Access, Oracle, Sybase, Informix, Postgres, and other database systems.
      To be able to run SQL, one has to structure the database properly.
      For SQL to run a programm in the DB, one has to structure the Table.
      Every table is broken up into smaller entities called fields. The fields in the Customers table consist of:
      CustomerID, CustomerName, ContactName, Address, City and PostalCode.
      A field is a column in a table that is designed to maintain specific information about every record in the table.

      This is an example of a customers table in a DB:

      CustomerID
      CustomerName
      ContactName
      Address
      City
      PostalCode
      Country

      Example
      SELECT * FROM Computer kids Academy;
      this sql statement says, select all (*) from Computer Kids Academy
      there are a number of SQL commands that every user should get used to.
      Example:

      Some of The Most Important SQL Commands
      SELECT - extracts data from a database
      UPDATE - updates data in a database
      DELETE - deletes data from a database
      INSERT INTO - inserts new data into a database
      CREATE DATABASE - creates a new database
      ALTER DATABASE - modifies a database
      CREATE TABLE - creates a new table
      ALTER TABLE - modifies a table
      DROP TABLE - deletes a table
      CREATE INDEX - creates an index (search key)
      DROP INDEX - deletes an index
      The SELECT statement is used to select data from a database.
      The data returned is stored in a result table, called the result-set.

      SELECT Column Example
      The following SQL statement selects the "CustomerName" and "City" columns from the "Customers" table:
      Example

      SELECT CustomerName, City FROM Customers;
      your table will look like this:
      CustomerName
      City
      Freddy
        Berlin 
      Ana
      Bomako
        peter
      México
      john
      London
        Lhh

      The SQL SELECT DISTINCT Statement
      The SELECT DISTINCT statement is used to return only distinct (different) values.
      Inside a table, a column often contains many duplicate values;
      and sometimes you only want to list the different (distinct) values.
      The SELECT DISTINCT statement is used to return only distinct (different) values.
      (SELECT DISTINCT column2, column5, ... FROM table_name; )

      Example
      SELECT City FROM Customers;
      Berlin
      Bomako 
      México
      London 
      SELECT country FROM Customers;

      SELECT Age FROM Customers;

      The SQL WHERE Clause

      The WHERE clause is used to filter records.
      The WHERE clause is used to extract only those records that fulfill a specified condition.
      WHERE Syntax
      SELECT column1, column2, ...
      FROM table_name
      WHERE condition;
      Note:
      The WHERE clause is not only used in SELECT statement, it is also used in UPDATE, DELETE statement, etc.!